package com.ruge.test.springMVC.定时任务调度.quartz;

import lombok.Getter;
import lombok.Setter;
import org.quartz.*;

import java.time.LocalDateTime;

/**
 * 爱丽丝、如歌  创建于 2018/6/22 15:23
 * 说明:  编写业务逻辑
 */
public class HelloJob2 implements Job {
    /**
     * 第二种获取传参的形式
     * 定义的变量名要和scheduler中的key的类型和参数名完全一致
     * @param jobExecutionContext
     * @throws JobExecutionException
     */
    @Getter
    @Setter
    private String message;
    @Getter
    @Setter
    private String message1;
    @Getter
    @Setter
    private Float floatJobValue;
    @Getter
    @Setter
    private double DoubleTriggerValue;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        /**
         * 打印当前的执行时间
         */
        System.out.println(LocalDateTime.now());
        JobKey key = jobExecutionContext.getJobDetail().getKey();
        TriggerKey key1 = jobExecutionContext.getTrigger().getKey();
        System.out.println(floatJobValue);
        System.out.println(message1);
        System.out.println(message);
        System.out.println(DoubleTriggerValue);
        System.out.println("JobKey==="+key.getName()+":"+key.getGroup()+" TriggerKey==="+key1.getName()+":"+key1.getGroup());
    }
}
